package com.hsylient.demo06;

import com.hsylient.demo04.JdbcUtil;
import lombok.SneakyThrows;

import java.sql.Connection;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;

public class TestMeta02 {

    @SneakyThrows
    public static void main(String[] args) {
        Connection connection = JdbcUtil.getConnection();
        String sql = "select * from test.user where id = ?";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setObject(1, 1004);
        ParameterMetaData parameterMetaData = preparedStatement.getParameterMetaData();
        System.out.println("当前参数的个数 = " + parameterMetaData.getParameterCount());
    }
}
